#include<iostream>
#include<windows.h>
#include<cstdlib>
using namespace std;
 
int foreColor = 7, backColor = 0;
 
void SetColor(int fore = 7, int back = 0)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (back << 4) + fore);
}
 
 
int main() 
{
	SetConsoleTitle(LPCWSTR(L"color test"));
 
	SetColor();
	cout << "This is default color config." << endl << endl;
 
	cout << " font Color: ";
	for (int i = 0; i < 16; ++i) 
    {
		if (i == 0) 
        { 
            SetColor(0, 7); 
            cout << ' ' << 0 << ' '; continue; 
        }
 
		SetColor(i, 0);
		cout << ' ' << i << ' ';
	}
 
	SetColor(); cout << endl << " back Color: ";
	for (int i = 0; i < 16; ++i) 
    {
		if (i == 0) 
        { 
            SetColor(7, 0); cout << ' ' << 0 << ' '; continue; 
        }
 
		SetColor(0, i);
		cout << ' ' << i << ' ';
	}
 
	cout << endl << endl; SetColor();
 
	std::system("pause");
	return 0;
}